home *** CD-ROM | disk | FTP | other *** search
/ Mac OS 9 Serial Number Archive / SN Archive 2023.11.04.toast / Cracking Texts / Cracking tutors Collection / Cracking tutors Collection.rsrc / TEXT_143.txt < prev    next >
Encoding:
Text File  |  2010-07-27  |  12.1 KB  |  137 lines

  1.  
  2. FrameMaker 3.0
  3.  
  4. Serial number dialog scheme again.  This one, however, presents a slight variation - Nosy won't disassemble it properly.  This means that you will have to do all your cracking from within TMON.
  5.  
  6. Step 1:  Where to start looking.
  7.  
  8. The only choice we have is to break in via TMON.  The simplest way to do this is to drop into TMON, set a Trace Interrupt for ModalDialog and Exit.  Now launch Framemaker 3.0 and wait for TMON to break in  Here is the code you would see: (note that this listing is from TMON Pro - a TMON 2.8.x listing will be slightly different)
  9.  
  10. 005B4F88:'CODE'¬Æ$0003Δí$040C+$0284 PEA      $01AA(A5)
  11. 005B4F8C:'CODE'¬Æ$0003Δí$040C+$0288 PEA      `FDEC(A6)
  12. 005B4F90:P 'CODE'¬Æ$0003Δí$040C+$2‚Ķ _ModalDialog
  13. 005B4F92:'CODE'¬Æ$0003Δí$040C+$028E MOVE.W  `FDEC(A6),D0
  14. 005B4F96:'CODE'¬Æ$0003Δí$040C+$0292 EXT.L      D0
  15. 005B4F98:'CODE'¬Æ$0003Δí$040C+$0294 MOVEQ      #$01,D1
  16. 005B4F9A:'CODE'¬Æ$0003Δí$040C+$0296 CMP.L      D0,D1
  17. 005B4F9C:'CODE'¬Æ$0003Δí$040C+$0298 BNE      ^$005B50EA                ;'CODE'¬Æ$0003Δí$040C+$3E6
  18. 005B4FA0:* 'CODE'¬Æ$0003Δí$040C+$2‚Ķ CLR.W      `FDEC(A6)
  19. 005B4FA4:'CODE'¬Æ$0003Δí$040C+$02A0 CLR.B      (A3)
  20. 005B4FA6:'CODE'¬Æ$0003Δí$040C+$02A2 TST.L      `96FA(A5)
  21. 005B4FAA:'CODE'¬Æ$0003Δí$040C+$02A6 BEQ.S      ^$005B4FC4                ;'CODE'¬Æ$0003Δí$040C+$2C0
  22. 005B4FAC:'CODE'¬Æ$0003Δí$040C+$02A8 MOVE.L  A4,-(A7)
  23. 005B4FAE:'CODE'¬Æ$0003Δí$040C+$02AA PEA      $3802                          ;$000037D8+$2A
  24. 005B4FB2:'CODE'¬Æ$0003Δí$040C+$02AE JSR      $1702(A5)
  25. 005B4FB6:'CODE'¬Æ$0003Δí$040C+$02B2 MOVE.L  A3,-(A7)
  26. 005B4FB8:'CODE'¬Æ$0003Δí$040C+$02B4 MOVE.L  A4,-(A7)
  27. 005B4FBA:'CODE'¬Æ$0003Δí$040C+$02B6 JSR      $419A(A5)
  28. 005B4FBE:'CODE'¬Æ$0003Δí$040C+$02BA LEA      $0010(A7),A7
  29. 005B4FC2:'CODE'¬Æ$0003Δí$040C+$02BE BRA.S      ^$005B4FE8                ;'CODE'¬Æ$0003Δí$040C+$2E4
  30. 005B4FC4:'CODE'¬Æ$0003Δí$040C+$02C0 MOVE.L  `FDE8(A6),-(A7)
  31. 005B4FC8:'CODE'¬Æ$0003Δí$040C+$02C4 MOVEQ      #$05,D0
  32. 005B4FCA:'CODE'¬Æ$0003Δí$040C+$02C6 MOVE.W  D0,-(A7)
  33. 005B4FCC:'CODE'¬Æ$0003Δí$040C+$02C8 PEA      `FDEE(A6)
  34. 005B4FD0:'CODE'¬Æ$0003Δí$040C+$02CC PEA      `FDF0(A6)
  35. 005B4FD4:'CODE'¬Æ$0003Δí$040C+$02D0 PEA      `FDF4(A6)
  36. 005B4FD8:'CODE'¬Æ$0003Δí$040C+$02D4 _GetDItem
  37. 005B4FDA:'CODE'¬Æ$0003Δí$040C+$02D6 TST.L      `FDF0(A6)
  38. 005B4FDE:'CODE'¬Æ$0003Δí$040C+$02DA BEQ.S      ^$005B4FE8                ;'CODE'¬Æ$0003Δí$040C+$2E4
  39. 005B4FE0:'CODE'¬Æ$0003Δí$040C+$02DC MOVE.L  `FDF0(A6),-(A7)
  40. 005B4FE4:'CODE'¬Æ$0003Δí$040C+$02E0 MOVE.L  A3,-(A7)
  41. 005B4FE6:'CODE'¬Æ$0003Δí$040C+$02E2 _GetIText
  42. 005B4FE8:'CODE'¬Æ$0003Δí$040C+$02E4 MOVE.L  A3,-(A7)
  43. 005B4FEA:'CODE'¬Æ$0003Δí$040C+$02E6 JSR      ^$005B5670                ;'CODE'¬Æ$0003Δí$040C+$96C
  44. 005B4FEE:'CODE'¬Æ$0003Δí$040C+$02EA TST.L      D0
  45. 005B4FF0:'CODE'¬Æ$0003Δí$040C+$02EC ADDQ.L  #4,A7
  46. 005B4FF2:'CODE'¬Æ$0003Δí$040C+$02EE BMI      ^$005B50C8                ;'CODE'¬Æ$0003Δí$040C+$3C4
  47. 005B4FF6:'CODE'¬Æ$0003Δí$040C+$02F2 CMPI.L  #$00000005,D0
  48. 005B4FFC:'CODE'¬Æ$0003Δí$040C+$02F8 BGT      ^$005B50C8                ;'CODE'¬Æ$0003Δí$040C+$3C4
  49. 005B5000:'CODE'¬Æ$0003Δí$040C+$02FC ADD.L      D0,D0
  50. 005B5002:'CODE'¬Æ$0003Δí$040C+$02FE MOVE.W  ^$005B500A(D0.L),D0            ;'CODE'¬Æ$0003Δí$040C+$306
  51. 005B5006:'CODE'¬Æ$0003Δí$040C+$0302 JMP      ^$005B5008(D0.W)            ;'CODE'¬Æ$0003Δí$040C+$304
  52.  
  53.  
  54. If you try to step through this and enter your name etc., you will find that ModalDialog is exiting after any keystroke.  The way to get around this hassle is to get rid of the Trace Interrupt and set a breakpoint after the OK button is hit.  How you ask?  Well, take a look at the code that follows the ModalDialog.  First, D0 gets the dialog item that was modified.  Next D1 gets the value 1 and the two are compared.  From Resedit, you can find the dialog item numbers for all the items and it turns out that item 1 is the OK button, and item 5 is the serial number - these are the two important ones since the program can't proceed until the OK button is hit (we don't care about the cancel button being hit) and then the program must check the serial number.  Following the compare, we note that if they are not equal (i.e. OK button not hit) then it goes off somewhere.  The next instruction must be the one that executes after the user hits the OK button.  So set your breakpoint at the line that reads CLR.W  FDEC(A6) which is at address 5B4FA0 (this will vary) - and in fact you can see the asterisk in the listing denoting that I have done just that.  Now exit, enter your name and company and serial number (keep typing anything until the OK button lights up) and hit OK.  Now TMON breaks in again at the breakpoint.  Now we can begin the crack.
  55.  
  56. Determining how to implement the crack.
  57.  
  58. Before you continue, think about what the program must do at this point if it wants to validate your serial number (here it helps to have read Inside Mac on dialogs).  First the program must obtain a pointer to the dialog item #5 (the serial number field) and then it must obtain a pointer to the text contained in that item.  Knowing this, you can just scan down until you see a GetDItem trap followed closely by a GetIText trap.  After this last trap, the program can do its validation.  Here is that piece of code:
  59.  
  60. MOVE.L  A3,-(A7)
  61. _GetIText
  62. MOVE.L  A3,-(A7)
  63. JSR      ^$005B5670        
  64. TST.L      D0
  65. ADDQ.L  #4,A7
  66. BMI      ^$005B50C8        
  67. CMPI.L  #$00000005,D0
  68. BGT      ^$005B50C8        
  69. ADD.L      D0,D0
  70. MOVE.W  ^$005B500A(D0.L),D0    
  71. JMP      ^$005B5008(D0.W)    
  72.  
  73. We can note that A3 is the pointer that will point to the text after the trap.  Once A3 has the text, a subroutine is called and D0 is tested.  At this point, we cannot be sure whether the branch executes if the serial passed or failed, so we had better take a quick look at the code at address 5B50C8.  I am not going to show it here, but that code does some crap then calles ParamText and then a Dialog call so it is probably safe to guess that the branch above jumps to the error code. 
  74.  
  75. With this assumption in mind, what can we do about it?  An initial guess would be to just make that BMI either not execute or even better, make the BMI branch down to the ADD.L D0,D0.  Unfortunately, if you look at the last two lines, you can see that D0 not only determines whether the code branches to the error routine, but is then used for a JMP instruction so we had better take care of D0.  Let's take a quick look at that JSR up a few lines that sets D0 in the first place and remember, we are trying to figure out what D0 should be set to.  Also remember that the branch is a BMI meaning that the error occurs if the high bit of D0 is set.
  76.  
  77. 004B1508:'CODE'¬Æ$0003Δí$04C8+$096C LINK.W  A6,#$FF00
  78. 004B150C:'CODE'¬Æ$0003Δí$04C8+$0970 MOVEM.L A3/A4,-(A7)
  79. 004B1510:'CODE'¬Æ$0003Δí$04C8+$0974 LEA      `FF00(A6),A4
  80. 004B1514:'CODE'¬Æ$0003Δí$04C8+$0978 MOVEA.L $0008(A6),A3
  81. 004B1518:'CODE'¬Æ$0003Δí$04C8+$097C MOVEQ      #$00,D0
  82. 004B151A:'CODE'¬Æ$0003Δí$04C8+$097E MOVE.B  (A3),D0
  83. 004B151C:'CODE'¬Æ$0003Δí$04C8+$0980 MOVEQ      #$06,D1
  84. 004B151E:'CODE'¬Æ$0003Δí$04C8+$0982 CMP.L      D0,D1
  85. 004B1520:'CODE'¬Æ$0003Δí$04C8+$0984 BLE.S      ^$004B1526                ;'CODE'¬Æ$0003Δí$04C8+$98A
  86. 004B1522:'CODE'¬Æ$0003Δí$04C8+$0986 MOVEQ      #`FF,D0
  87. 004B1524:'CODE'¬Æ$0003Δí$04C8+$0988 BRA.S      ^$004B1592                ;'CODE'¬Æ$0003Δí$04C8+$9F6
  88. 004B1526:'CODE'¬Æ$0003Δí$04C8+$098A MOVEQ      #$00,D0
  89. 004B1528:'CODE'¬Æ$0003Δí$04C8+$098C MOVE.B  (A3),D0
  90. 004B152A:'CODE'¬Æ$0003Δí$04C8+$098E MOVEQ      #$28,D1                        ;'('
  91. 004B152C:'CODE'¬Æ$0003Δí$04C8+$0990 CMP.L      D0,D1
  92. 004B152E:'CODE'¬Æ$0003Δí$04C8+$0992 BGE.S      ^$004B1534                ;'CODE'¬Æ$0003Δí$04C8+$998
  93. 004B1530:'CODE'¬Æ$0003Δí$04C8+$0994 MOVEQ      #`FF,D0
  94. 004B1532:'CODE'¬Æ$0003Δí$04C8+$0996 BRA.S      ^$004B1592                ;'CODE'¬Æ$0003Δí$04C8+$9F6
  95. 004B1534:'CODE'¬Æ$0003Δí$04C8+$0998 MOVE.L  A4,-(A7)
  96. 004B1536:'CODE'¬Æ$0003Δí$04C8+$099A PEA      $3802                          ;$000037D8+$2A
  97. 004B153A:'CODE'¬Æ$0003Δí$04C8+$099E JSR      $1702(A5)
  98. 004B153E:'CODE'¬Æ$0003Δí$04C8+$09A2 MOVE.L  A4,-(A7)
  99. 004B1540:'CODE'¬Æ$0003Δí$04C8+$09A4 JSR      $0532(A5)
  100. 004B1544:'CODE'¬Æ$0003Δí$04C8+$09A8 MOVE.L  A3,-(A7)
  101. 004B1546:'CODE'¬Æ$0003Δí$04C8+$09AA MOVE.L  A4,-(A7)
  102. 004B1548:'CODE'¬Æ$0003Δí$04C8+$09AC JSR      $0392(A5)
  103. 004B154C:'CODE'¬Æ$0003Δí$04C8+$09B0 TST.L      D0
  104. 004B154E:'CODE'¬Æ$0003Δí$04C8+$09B2 LEA      $0014(A7),A7
  105. 004B1552:'CODE'¬Æ$0003Δí$04C8+$09B6 BEQ.S      ^$004B1558                ;'CODE'¬Æ$0003Δí$04C8+$9BC
  106. 004B1554:'CODE'¬Æ$0003Δí$04C8+$09B8 MOVEQ      #$05,D0
  107. 004B1556:'CODE'¬Æ$0003Δí$04C8+$09BA BRA.S      ^$004B1592                ;'CODE'¬Æ$0003Δí$04C8+$9F6
  108. 004B1558:'CODE'¬Æ$0003Δí$04C8+$09BC MOVE.B  $0001(A3),D0
  109. 004B155C:'CODE'¬Æ$0003Δí$04C8+$09C0 SUBI.B  #$30,D0
  110. 004B1560:'CODE'¬Æ$0003Δí$04C8+$09C4 BCS.S      ^$004B1590                ;'CODE'¬Æ$0003Δí$04C8+$9F4
  111. 004B1562:'CODE'¬Æ$0003Δí$04C8+$09C6 CMPI.B  #$02,D0
  112. 004B1566:'CODE'¬Æ$0003Δí$04C8+$09CA BHI.S      ^$004B1590                ;'CODE'¬Æ$0003Δí$04C8+$9F4
  113. 004B1568:'CODE'¬Æ$0003Δí$04C8+$09CC MOVEQ      #$00,D1
  114. 004B156A:'CODE'¬Æ$0003Δí$04C8+$09CE MOVE.B  D0,D1
  115. 004B156C:'CODE'¬Æ$0003Δí$04C8+$09D0 ADD.W      D1,D1
  116. 004B156E:'CODE'¬Æ$0003Δí$04C8+$09D2 MOVE.W  ^$004B1576(D1.W),D1            ;'CODE'¬Æ$0003Δí$04C8+$9DA
  117. 004B1572:'CODE'¬Æ$0003Δí$04C8+$09D6 JMP      ^$004B1574(D1.W)            ;'CODE'¬Æ$0003Δí$04C8+$9D8
  118.  
  119. There are no traps here to quickly tell us what is happening, but we can quickly look at the lines that affect D0.  Basically, there are a bunch of interspersed MOVEQ instructions putting various values into D0.  One of the values is $FF which (since the high bit of $FF is set - in fact, all the bits of $FF are set) must trigger the error in the previous procedure.  Other values include 5 and 0.  Right now, that is enough information to proceed with the previous procedure - if we need more in depth info, we can always come back.  So we have the following code again:
  120.  
  121. MOVE.L  A3,-(A7)
  122. JSR      ^$005B5670        
  123. TST.L      D0
  124. ADDQ.L  #4,A7
  125. BMI      ^$005B50C8        
  126. CMPI.L  #$00000005,D0
  127. BGT      ^$005B50C8        
  128. ADD.L      D0,D0
  129. MOVE.W  ^$005B500A(D0.L),D0    
  130. JMP      ^$005B5008(D0.W)    
  131.  
  132. Once again, we have an initial BMI which tells us that $FF won't work for D0.  We also have BGT after comparing D0 with 5 which branches to the error - so D0 must be between 0 and 5 (the other values we noted from the subroutine above).  At this point, I would (and did) simply try inserting values into D0.  I started with 5 and the program went into Demo mode - strike one.  Next I tried 1 and some other error occured.  Finally, I tried 0 and the program continued flawlessly.
  133.  
  134. So you are asking, how exactly might you go about inserting these values into D0?  Consider: once D0 is set to the proper value, the two branches become meaningless since they would not execute anyways (they only execute if there is an error).  This little tidbit tells us that we can safely overwrite these instructions with anything we like.  So we have several free bytes to put our own code into (don't panic yet - this is pretty straightforward) and all our code has to do is set D0 to 0 then proceed.  One quick note:  Never Never Ever modify code that affects the stack.  If you do, you can easily cause system errors later on down the road.  In the above code, this translates into not changing the ADDQ.L  #4,A7 (A7 is the stack pointer, remember?).  So what is the easiest way to put 0 into D0?  Use a MOVEQ instruction.  This is particularly nice because you probably do not know the machine hex code for instructions (like me).  But that subroutine we looked at before is chalk full of MOVEQ instructions.  If you look, a MOVEQ 0 #0,D0 translates into 70 00.  So far so good except that the stupid BMI is one of those 4 byte branches.  So we still have two bytes left that will be garbage since we just changed the first two.  This is an excellent candidate for a NOP instruction - a two byte instruction that does absolutely nothing.  The code for this (from the Cracker's Guide Part 1) is 4E 71.
  135.  
  136. So, open a dump window to the PC and find the BMI (I think it is 68 00 00 D4 or something like that).  Change the four values to 70 00 4E 71 and now the program loads D0 with the correct value and proceeds as if nothing had happened.  Now you have the crack, but you want to make a cracked / un-serialized copy right?  So, unstuff a fresh copy of the application, open it in Resedit, and open the proper CODE resource.  To find the ID #, look back at the TMON listing.  It says CODE 0003 plus some benutia about the File reference number and then +nnnn where nnnn is the offset from the beginning of the Code resource.  There is all you need.  Open CODE ID 3 and jump down to line 2E8 (since 2EE is our byte) and change the 68 00 00 D4 to 70 00 4E 71.  Now run it and enter anything you like for the serial number.
  137.